package com.jcl.recruit.resume.dao;

import com.jcl.core.db.DatabaseContext;
import com.jcl.recruit.resume.mapper.ResumeProjectMapper;
import com.jcl.recruit.resume.model.ResumeProject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Component
public class ResumeProjectDao implements ResumeProjectMapper {

    @Autowired
    private ResumeProjectMapper resumeProjectMapper;

    @Override
    public List<ResumeProject> findListByResumeIds(String corpCode, List<Integer> resumeIds) {
        DatabaseContext.setCurrentContext();
        return resumeProjectMapper.findListByResumeIds(corpCode, resumeIds);
    }

    @Override
    public List<ResumeProject> findListByResumeId(String corpCode, Integer resumeId) {
        DatabaseContext.setCurrentContext();
        return resumeProjectMapper.findListByResumeId(corpCode, resumeId);
    }

    @Override
    public List<Map<String, Object>> findObjListByResumeId(String corpCode, Integer resumeId) {
        DatabaseContext.setCurrentContext();
        return resumeProjectMapper.findObjListByResumeId(corpCode, resumeId);
    }

    @Override
    public int isExitEntity(ResumeProject entity) {
        DatabaseContext.setCurrentContext();
        return resumeProjectMapper.isExitEntity(entity);
    }

    @Override
    public int batchInsert(List<ResumeProject> list) {
        DatabaseContext.setCurrentContext();
        return resumeProjectMapper.batchInsert(list);
    }

    @Override
    public int insert(ResumeProject entity) {
        DatabaseContext.setCurrentContext();
        return resumeProjectMapper.insert(entity);
    }

    @Override
    public int updateByPrimaryKey(ResumeProject entity) {
        DatabaseContext.setCurrentContext();
        return resumeProjectMapper.updateByPrimaryKey(entity);
    }

    @Override
    public int deleteById(Integer id) {
        DatabaseContext.setCurrentContext();
        return resumeProjectMapper.deleteById(id);
    }

    @Override
    public int batchDeleteByResumeIds(String corpCode, List<Integer> resumeIds) {
        DatabaseContext.setCurrentContext();
        return resumeProjectMapper.batchDeleteByResumeIds(corpCode, resumeIds);
    }
}
